<?php
declare (strict_types = 1);

namespace app\home\controller;

use app\home\business\OrderBusiness;
use think\exception\HttpException;
use think\facade\View;
use think\Request;

class Order extends Base
{
    /**
     * @return string
     */
   public function getOrderInfo(){

       try {
           if (!session("?userInfo")) {
               # 保存一下回调的路由
               cookie('redirect_url','http://pyg.com/getOrderInfo');
               return  redirect('/login');//未登录、不能查看订单信息
           }
            $data = OrderBusiness::getOrderInfo();
            # 判断是否有选中商品
            if (count($data['goods']) <= 0) {
                return  redirect('/');
            }

            View::assign('data',$data);
           return View::fetch();
       }catch (HttpException $httpException) {
          return redirect('/');
       }


   }

    /**
     * 我的订单
     * @return string
     */
   public function myOrder(){
       return View::fetch();
   }
}
